package com.DreamTeam.daoProxy;

import java.util.List;

import com.DreamTeam.dao.IStatisticalAnalysis;
import com.DreamTeam.dao.IStatisticalDao;
import com.DreamTeam.daoImpl.StatisticalAnalysis;
import com.DreamTeam.daoImpl.StatisticalDao;
import com.DreamTeam.dbc.MySqlConnection;
import com.DreamTeam.po.OrderMaster;
import com.DreamTeam.vo.StaAnalCustomer;
import com.DreamTeam.vo.StaAnalEmployee;
import com.DreamTeam.vo.StaAnalProductClass;

public class StatisticalDaoProxy implements IStatisticalDao,IStatisticalAnalysis {
	private IStatisticalDao statisticalDao;
	private MySqlConnection conn;
	private IStatisticalAnalysis statisticalAnalysis;
	public StatisticalDaoProxy(){
		conn = new MySqlConnection();
		statisticalDao = new StatisticalDao(conn.getConnection());
		statisticalAnalysis = new StatisticalAnalysis(conn.getConnection());
	}
	@Override
	public boolean autoUpdateOrderSum() {
		boolean flag = statisticalDao.autoUpdateOrderSum();
		conn.closeConnection();
		return flag;
	}
	@Override
	public List<StaAnalEmployee> staAnalByEmployee() {
		List<StaAnalEmployee> list = statisticalAnalysis.staAnalByEmployee();
		conn.closeConnection();
		return list;
	}
	@Override
	public List<StaAnalCustomer> staAnalByCustomer() {
		List<StaAnalCustomer> list =statisticalAnalysis.staAnalByCustomer();
		conn.closeConnection();
		return list;
	}
	@Override
	public List<StaAnalProductClass> staAnalByProductClass() {
		List<StaAnalProductClass> list = statisticalAnalysis.staAnalByProductClass();
		conn.closeConnection();
		return list;
	}
	@Override
	public List<OrderMaster> orderByPrice(double low, double high) {
		List<OrderMaster> list = statisticalAnalysis.orderByPrice(low, high);
		conn.closeConnection();
		return list;
	}

}
